﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace UserControls.Common
{
    /// <summary>
    /// QuestionWindow.xaml 的交互逻辑
    /// </summary>
    public partial class QuestionWindow : Window
    {
        public QuestionWindow(string message,string title,string buttonConfirmTextText,string buttonCancelText)
        {
            InitializeComponent();
            txtMessage.Text = message;
            Title = title??"请确认";
            btnYes.Content = buttonConfirmTextText??"是";
            btnNo.Content = buttonCancelText??"否";
            this.DialogResult = false;
            Owner = Application.Current.Windows[Application.Current.Windows.Count - 2];
        }

        private void ConfirmCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();
        }

        private void CancelCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this.Close();
        }
    }
}
